<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link th:href="@{/local/css/goodsList.css}" rel="stylesheet">
    <link th:href="@{/css/viewer.css}" rel="stylesheet">
    <link th:href="@{/css/layer.css}" rel="stylesheet">
    <link th:href="@{/local/css/page.css}" rel="stylesheet">
</head>
<body>
<div th:replace="~{head.html}"></div>
<div id="middle">
    <div th:replace="~{left.html::left}"></div>
    <div id="right">
        <form action="/admin/goods/gotoAddGoods" method="get">
            <input type="submit" value="添加商品">
        </form>
        <div id="msg" th:text="${msg}"></div>
        <table>
            <tr>
                <th>商品ID</th>
                <th>商品编号</th>
                <th>商品名称</th>
                <th>商品类别</th>
                <th>商品单价</th>
                <th>库存</th>
                <th>销售量</th>
                <th>热销</th>
                <th>添加时间</th>
                <th>图片</th>
                <th>操作</th>
            </tr>
            <tr th:each="goods:${goodsListPage.list}">
                <td th:text="${goods.getId()}"></td>
                <td th:text="${goods.getCode()}"></td>

                <td class="width150">
                    <span th:text="${#strings.abbreviate(goods.getName(),10)}"></span>
                    <input type="hidden" th:value="${goods.getName()}">
                </td>

                <td th:text="${goods.getCategory().getName()}"></td>
                <td th:text="${goods.getPrice()}"></td>
                <td th:text="${goods.getQuantity()}"></td>
                <td th:text="${goods.getSaleQuantity()}"></td>
                <td>
                    <span th:if="${goods.getHot()} eq 1">是</span>
                    <span th:unless="${goods.getHot()} eq 1">否</span>
                </td>

                <td th:text="${#dates.format(goods.getAddtime(),'yyyy-mm-dd hh:MM:ss')}"></td>

                <td><img class="listimg" th:src="${goods.getImage()}">
                </td>
                <td>
                    <a th:href="@{/admin/goods/delGoods/} + ${goods.getId()}">删除</a>
                    <a href="#" th:onclick="delGoods(this, [[${goods.getId()}]] )">删除(ajax)</a>
                    <a th:href="@{/admin/goods/} + ${goods.getId()}">编辑</a>

                </td>
            </tr>
        </table>
        <div th:replace="~{page.html::myPage(${goodsListPage},'/admin/goods/getGoodsList')}"></div>
    </div>
</div>
<div  th:replace="~{bottom.html::bottom}"></div>

<script th:src="@{/js/jquery-3.6.4.js}"></script>
<script th:src="@{/js/viewer.js}"></script>
<script th:src="@{/js/jquery-viewer.js}"></script>
<script th:src="@{/js/layer.js}"></script>
<script th:src="@{/local/js/goodsList.js}"></script>
</body>
</html>